<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    //return $router->app->version();
    echo '不告诉你...';
});


//后台管理API
$router->group(['prefix'=>'/api/admin', 'namespace'=>'Admin'], function () use ($router) {
    $router->post('dologin', 'IndexController@dologin');
    $router->post('cate/list', 'CateController@index');
    $router->post('cate/modify', 'CateController@modify');
    $router->post('cate/del', 'CateController@del');
    $router->post('banner/list', 'BannerController@index');
    $router->post('banner/modify', 'BannerController@modify');
    $router->post('banner/del', 'BannerController@del');
    $router->post('xcx/list', 'XcxController@index');
    $router->post('xcx/modify', 'XcxController@modify');
    $router->post('xcx/config/one', 'XcxController@configOne');
    $router->post('xcx/config/modify', 'XcxController@configModify');
    $router->post('visit/list', 'UserController@visitList');
    $router->post('wx/list', 'UserController@wxList');
    $router->post('address/list', 'AddressController@index');
    $router->post('address/modify', 'AddressController@modify');
    $router->post('address/del', 'AddressController@del');
    //商城管理
    $router->group(['prefix'=>'mall', 'namespace'=>'Mall'], function () use ($router) {
        $router->post('shop/list', 'ShopController@index');
        $router->post('shop/modify', 'ShopController@modify');
        $router->post('shop/del', 'ShopController@del');
        $router->post('goods/list', 'GoodsController@index');
        $router->post('goods/option', 'GoodsController@option');
        $router->post('goods/modify', 'GoodsController@modify');
        $router->post('goods/del', 'GoodsController@del');
        $router->post('cart/list', 'CartController@index');
        $router->post('order/list', 'OrderController@index');
        $router->post('order/pay', 'OrderController@pay');
        $router->post('order/send', 'OrderController@send');
        $router->post('order/finish', 'OrderController@finish');
    });
    //邀请函管理
    $router->group(['prefix'=>'yqh', 'namespace'=>'Yqh'], function () use ($router) {
        $router->post('index', 'YqhController@index');
        $router->post('modify', 'YqhController@modify');
        $router->post('del', 'YqhController@del');
        $router->post('flow/index', 'FlowController@index');
        $router->post('flow/modify', 'FlowController@modify');
        $router->post('flow/del', 'FlowController@del');
    });
});


//小程序
$router->group(['prefix'=>'/api/xcx', 'namespace'=>'Xcx'], function () use ($router) {
    $router->post('wxauth/one', 'IndexController@wxOne');
    $router->post('wxauth/modify', 'IndexController@wxModify');
    $router->post('wxauth/head', 'IndexController@wxHead');
    $router->post('init', 'IndexController@init');
    $router->post('type/init', 'IndexController@typeInit');
    $router->post('banner/list', 'IndexController@banner');
    $router->post('my/index', 'IndexController@my');
    $router->post('address/list', 'AddressController@index');
    $router->post('address/one', 'AddressController@one');
    $router->post('address/modify', 'AddressController@modify');
    $router->post('address/del', 'AddressController@del');
    $router->post('address/default', 'AddressController@todefault');
    $router->post('address/defaultone', 'AddressController@defaultOne');
    //商城
    $router->group(['prefix' => 'mall', 'namespace'=>'Mall'], function () use ($router) {
        $router->post('cate/list', 'GoodsController@cateList');
        $router->post('goods/list', 'GoodsController@getList');
        $router->post('goods/one', 'GoodsController@getOne');
        $router->post('cart/list', 'CartController@getList');
        $router->post('cart/add', 'CartController@add');
        $router->post('cart/reduce', 'CartController@reduce');
        $router->post('order/list', 'OrderController@index');
        $router->post('order/addbygid', 'OrderController@addByGid');
        $router->post('order/addbycart', 'OrderController@addByCart');
        $router->post('order/one', 'OrderController@one');
    });
    //邀请函
    $router->group(['prefix' => 'yqh'], function () use ($router) {
        $router->post('one', 'YqhController@one');
        $router->post('flow/list', 'YqhController@flowList');
        $router->post('apply', 'YqhController@apply');
    });
});


//客户管理H5
$router->group(['prefix'=>'/api/kehu'], function () use ($router) {
    $router->post('index', 'KehuController@index');
    $router->post('one', 'KehuController@one');
    $router->post('add', 'KehuController@add');
    $router->get('toarea', 'KehuController@toarea');
    $router->get('sel', 'KehuController@sel');
});